package test.aat.ejinr.dataw;

import test.aat.ejinr.chk.HttpRequest;

public class HxwUserChk {

	public static void main(String[] args) {
		System.out.println(testHxw("", "", "15001236918")+"   "+testHxw("", "", "18210239323"));
	}

	/**
	 * 
	 * @param ip  代理的IP地址
	 * @param port 代理的端口号
	 * @param phone 验证的手机号码
	 * @result {"state":"Y","msg":"可用"}或者{"state":"N","msg":"该手机号已经注册"}
	 */
	private static boolean testHxw(String ip, String port, String phone) {
		if (null == ip || ip.length() == 0 || null == port || port.length() == 0) {

		} else {
			System.setProperty("http.maxRedirects", "50");
			System.getProperties().setProperty("proxySet", "true");
			System.getProperties().setProperty("http.proxyHost", ip);
			System.getProperties().setProperty("http.proxyPort", port);
		}
		String s1 = HttpRequest.sendPost("https://reg.hexun.com/rest/ajaxlogin.aspx",
				"mobile=" + phone + "&act=checkmobile", "gbk");
		boolean b=true;
		if(s1.contains("N")){
			 b=true;
		}else{
			b=false;
		}
		return b;
	}

}
